diff options
| author | Adam Soltys <[email protected]> | 2026-02-15 16:58:17 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-15 16:58:17 -0800 |
| commit | c7e8f628aa215caaa999f06d7fccb910fd5cc099 (patch) | |
| tree | 86af97b298f4d4023b5b00a4c2498b218ecda628 /src/routes/(app)/send/bitcoin/[address]/+layout.server.ts | |
| parent | 5323057a68c1e2607128a3b216a767802725c52c (diff) | |
| download | coinos-ui-c7e8f628aa215caaa999f06d7fccb910fd5cc099.tar.gz coinos-ui-c7e8f628aa215caaa999f06d7fccb910fd5cc099.zip | |
fix custodial bitcoin sends
Diffstat (limited to 'src/routes/(app)/send/bitcoin/[address]/+layout.server.ts')
| -rw-r--r-- | src/routes/(app)/send/bitcoin/[address]/+layout.server.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts index d8df1986..6acb36b6 100644 --- a/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts +++ b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts @@ -15,10 +15,13 @@ export async function load({ cookies, params, parent }) { } if (invoice) { - const recipient = await get(`/users/${invoice.uid}`); - let r = `/pay/${recipient.username}`; - if (amount) r += `/${amount}`; - if (recipient?.id !== user.id) redirect(307, r); + const isVault = invoice.account?.pubkey || invoice.account?.seed; + if (isVault) { + // Vault account — stay on /send/bitcoin for on-chain send + } else { + // Custodial account — send internally via the original invoice + if (invoice.uid !== user.id) redirect(307, `/send/invoice/${invoice.id}`); + } } return { balance }; |
